home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_exmh.idb / usr / freeware / lib / exmh-2.5 / fdispColor.tcl.z / fdispColor.tcl
Text File  |  2002-07-08  |  5KB  |  120 lines

  1. #
  2. # fdispLabel.tcl
  3. #
  4. # This sets the color (or monochrome) feedback for the folder display area.
  5. # There are four states for a label, normal, unseen, target, current.
  6. # Each label has two parts, a box and text.
  7. # (Some labels can be bitmaps, in which case they just have a bitmap.)
  8. # You can read the TK man page on the canvas widget to see what
  9. # sort of looks are possible for text and rectangles.  The defaults use
  10. # -fill color        ;# for text color
  11. # -fill color        ;# for box background
  12. # -outline color    ;# for box outline color
  13. # -width number        ;# for box outline width
  14. # -stipple bitmap    ;# for box stipple pattern
  15. #
  16. # In turn, for color displays, there are 5 basic colors that can be set
  17. # by ~/.exmh_defaults
  18. # Resource    Variable        Comment
  19. # c_foreground    $fdisp(c_fg)        Foreground
  20. # c_background    $fdisp(c_bg)        Background
  21. # c_current    $fdisp(c_current)    Current folder
  22. # c_unseen    $fdisp(c_unseen)    Unseen messages in the folder
  23. # c_moved    $fdisp(c_moved)        Target folder / moved message
  24. # c_deleted    $fdisp(c_deleted)    Deleted message
  25. #
  26. # For monochrome displays, the Canvas.foreground and Canvas.background
  27. # resources determine the foreground and background colors of the labels
  28. #
  29. # For consistency these colors are shared with the folder table of contents
  30. # display.  If you find this limiting, wack away on the itemconfigures...
  31. #
  32. # Copyright (c) 1993 Xerox Corporation.
  33. # Use and copying of this software and preparation of derivative works based
  34. # upon this software are permitted. Any distribution of this software or
  35. # derivative works must comply with all applicable United States export
  36. # control laws. This software is made available AS IS, and Xerox Corporation
  37. # makes no warranty about the software, its performance or its conformity to
  38. # any specification.
  39.  
  40. proc Fdisp_LabelConfigure { canvas } {
  41.     global fdisp
  42.     #
  43.     # Note that a particular label may have multiple tags, so more than
  44.     # one of these itemconfigures will hit.  Therefore their ordering
  45.     # is important, and you can play some tricks with combinations.
  46.     # (more so on color displays)
  47.     # 
  48.     Fdisp_FixupSpecials $canvas
  49.     if {[winfo depth .] <= 4} {
  50.     set fg [option get . c_foreground {}]
  51.     set bg [option get . c_background {}]
  52.     $canvas itemconfigure text -fill $fg
  53.     $canvas itemconfigure box -fill $bg -width 1 -stipple {} -outline $fg
  54.     $canvas itemconfigure bitmap -foreground $fg -background $bg
  55.  
  56.     $canvas itemconfigure unsntext -fill $fg
  57.     $canvas itemconfigure unsnbox -width 3 -outline $fg
  58.     $canvas itemconfigure unsnbitmap -foreground $bg -background $fg
  59.  
  60.     $canvas itemconfigure tartext -fill $fg
  61.     $canvas itemconfigure tarbox -fill $fg -stipple gray25
  62.     $canvas itemconfigure tarbitmap -foreground $bg -background $fg
  63.  
  64.     $canvas itemconfigure curtext -fill $bg
  65.     $canvas itemconfigure curbox -fill $fg -stipple {}
  66.     $canvas itemconfigure curbitmap -foreground $bg -background $fg
  67.     } else {
  68.     $canvas itemconfigure text -fill $fdisp(c_fg)
  69.     $canvas itemconfigure box -fill $fdisp(c_bg) \
  70.                 -outline $fdisp(c_fg) -width 1 -stipple {}
  71.     $canvas itemconfigure bitmap -foreground $fdisp(c_fg) \
  72.                 -background $fdisp(c_bg)
  73.  
  74.     # Let current text be overridden by unseen & target feedback
  75.     $canvas itemconfigure curtext -fill $fdisp(c_current)
  76.  
  77.     $canvas itemconfigure unsntext -fill $fdisp(c_unseenBg)
  78.     $canvas itemconfigure unsnbox -fill $fdisp(c_unseen)
  79.     $canvas itemconfigure unsnbox -outline $fdisp(c_unseen) -width 2
  80.     $canvas itemconfigure unsnbitmap -foreground $fdisp(c_unseen) \
  81.                     -background $fdisp(c_bg)
  82.  
  83.     $canvas itemconfigure tartext -fill $fdisp(c_movedFg)
  84.     $canvas itemconfigure tarbox -fill $fdisp(c_moved)
  85.     $canvas itemconfigure tarbitmap -foreground $fdisp(c_moved) \
  86.                     -background $fdisp(c_bg)
  87.  
  88.     $canvas itemconfigure curbox -outline $fdisp(c_current) -width 2
  89.     $canvas itemconfigure curbitmap -foreground $fdisp(c_current) \
  90.                     -background $fdisp(c_bg)
  91.     }
  92. }
  93.  
  94. proc FdispClearHighlights { can } {
  95.     global fdisp
  96.  
  97.     set canvas $fdisp($can)
  98.  
  99.     foreach tag [concat {unsnbitmap unsnbox unsntext} $fdisp(leafs,$can)] {
  100.     $canvas dtag $tag
  101.     }
  102.     # The leaf tags cause ancestor nodes to be highlighted
  103.     set fdisp(leafs,$can) {}
  104.  
  105.     # Deleting tags does not undo looks (like text widget!)
  106.     # So we manually reset looks on the labels here.
  107.     if {[winfo depth .] <= 4} {
  108.     $canvas itemconfigure text -fill black
  109.     $canvas itemconfigure box -fill white -width 1 -stipple {}
  110.     $canvas itemconfigure bitmap -foreground black -background white
  111.     } else {
  112.     $canvas itemconfigure text -fill $fdisp(c_fg)
  113.     $canvas itemconfigure box -fill $fdisp(c_bg) \
  114.                 -outline $fdisp(c_fg) -width 1 -stipple {}
  115.     $canvas itemconfigure bitmap -foreground $fdisp(c_fg) \
  116.                 -background $fdisp(c_bg)
  117.     }
  118. }
  119.  
  120.